feat: dashboard PR B — battery OOS, AC output telemetry, battery maintenance mode#122
Conversation
|
Warning Review limit reached
More reviews will be available in 34 minutes and 33 seconds. Learn how PR review limits work. Your organization has run out of usage credits. Purchase more in the billing tab. ⌛ How to resolve this issue?After more reviews become available, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available. Please see our Fair Usage Limits Policy for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (5)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
|
Overall Grade |
Security Reliability Complexity Hygiene |
Code Review Summary
| Analyzer | Status | Updated (UTC) | Details |
|---|---|---|---|
| Python | Jun 4, 2026 6:38a.m. | Review ↗ |
Important
AI Review is run only on demand for your team. We're only showing results of static analysis review right now. To trigger AI Review, comment @deepsourcebot review on this thread.
There was a problem hiding this comment.
Code Review
This pull request updates the GivEnergy Local integration to mirror the DeviceInfo from sensor.py in binary_sensor.py, ensuring correct entity ID prefixing. It also updates the dashboard configuration and templates to include the battery out-of-spec binary sensor, AC output metrics, and the battery maintenance mode sensor, with corresponding test coverage added. Feedback recommends adding skip_if_none=True to the battery_maintenance_mode sensor description to avoid it appearing as unknown on single-phase inverters, and moving the local import of _device_kind to the top of the file as there is no circular dependency.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
| - entity: {_i(inv, "battery_maintenance_mode")} | ||
| name: Battery Maintenance Mode |
There was a problem hiding this comment.
The PR description states that battery_maintenance_mode is three-phase only and that skip_if_none keeps the entity absent on single-phase inverters. However, in sensor.py (line 176), the GivEnergyInverterSensorDescription for battery_maintenance_mode does not have skip_if_none=True set.\n\nWithout skip_if_none=True, this entity will still be created on single-phase inverters but will remain permanently unknown or unavailable. Please update the sensor description in sensor.py to include skip_if_none=True to align with the intended behavior.
| from .sensor import _device_kind # local import to avoid module cycle | ||
|
|
||
| serial = coordinator.data.inverter_serial_number |
There was a problem hiding this comment.
There is no circular dependency between sensor.py and binary_sensor.py because sensor.py does not import binary_sensor. Therefore, the local import of _device_kind is unnecessary and can be moved to the top of the file to adhere to PEP 8 style guidelines.
| from .sensor import _device_kind # local import to avoid module cycle | |
| serial = coordinator.data.inverter_serial_number | |
| serial = coordinator.data.inverter_serial_number |
References
- PEP 8 recommends placing all imports at the top of the file, immediately after any module comments and docstrings, and before module globals and constants. (link)
|
Gemini's two findings addressed in 26b1ecd:
|
…tenance mode - Surfaces the battery_out_of_spec binary sensor on the Overview Status glance and Diagnostics → Faults & Warnings. - Adds AC output voltage/frequency/current to Diagnostics → Electrical, alongside the existing AC input metrics (relabelled for clarity). - Adds battery_maintenance_mode to Diagnostics → Hardware & Firmware (three-phase only; skip_if_none handles the gating). - Aligns binary_sensor's DeviceInfo with sensor.py so its entity_id slug picks up the GivEnergy Inverter device-name prefix consistently. - Bumps DASHBOARD_VERSION to 9. Refs #78.
… import Add skip_if_none=True to the battery_maintenance_mode sensor so the entity doesn't appear as Unknown on single-phase installs where HR 1124 is absent. Move the _device_kind import in binary_sensor.py to module level — no circular dependency exists. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
26b1ecd to
e329364
Compare
Summary
Mid-priority observability gaps, building on PR A.
binary_sensor, Expose a single "battery out of spec" binary_sensor (sustained voltage/temperature excursions) #78) now surfaces on the Overview Status glance and Diagnostics → Faults & Warnings. Existing platform code didn't carry aname=in DeviceInfo, so HA was registering the entity_id asbinary_sensor.battery_out_of_spec(no device prefix). Aligned its DeviceInfo withsensor.py(name="GivEnergy Inverter <serial>") so the slug becomesbinary_sensor.givenergy_inverter_<serial>_battery_out_of_spec— consistent with every other platform.skip_if_nonekeeps the entity absent on single-phase inverters.DASHBOARD_VERSION→ 9 so existing installs see the Repairs prompt.Refs #78. Branched off
main, independent from PR #121.Test plan
uv run pytest): 231 passed.binary_sensor.battery_out_of_speckeeps its entity_id (HA preserves it for existing installs); fresh install — verify the new prefixed entity_id is generated.🤖 Generated with Claude Code